package niuke;

import java.util.Scanner;

public class 数字和为sum的方法数 {

    static int n,sum;
    static int[] a;
    static int result = 0;
    static int[][] dp;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        sum = scanner.nextInt();
        a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = scanner.nextInt();
        }
        dp = new int[n+1][sum+1];
        dp();
        //dfs(0,0);
        //System.out.println(result);
    }

    //递归搜索办法（超时）
    public static void dfs(int k,int sum2){
        for(int i=k;i<n;i++){
            sum2 = sum2 + a[i];
            if(sum2 > sum){
                sum2 = sum2 - a[i];
                continue;
            }
            else if(sum2 == sum){
                result++;
                sum2 = sum2 - a[i];
                continue;
            }
            dfs(i+1,sum2);
            sum2 = sum2 - a[i];
        }
    }

    //动态规划法
    public static void dp(){
        //初始化dp   dp[n][sum] : 表示前n个数和为sum的方法数

        //一个数都没有
        for(int sum2 = 0;sum2<=sum;sum2++){
            dp[0][sum2] = 0;
        }
        //和为0
        for(int n2=0;n2<=n;n2++){
            dp[n2][0] = 1;
        }

        for(int n2=1;n2<=n;n2++){
            for(int sum2=1;sum2<=sum;sum2++){
                if(a[n2-1]<=sum2){
                    dp[n2][sum2] = dp[n2-1][sum2] + dp[n2-1][sum2-a[n2-1]];
                }
                else {
                    dp[n2][sum2] = dp[n2-1][sum2];
                }
            }
        }
        System.out.println(dp[n][sum]);
    }
}
